package com.jqk.shoporder.feign;

import com.jqk.shoporder.bean.Product;
import com.jqk.shoporder.feign.fallback.ProductServiceFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @Author:jiangqikun
 * @Date:2022/3/1 19:29
 *
 * FeignClient : 声明调用的提供者的name
 * FeignClient + GetMapping 就是完整的调用路径
 *
 * 下面的方式是指定容错类
 **/
//@FeignClient("shop-product")
@FeignClient(value = "shop-product", fallback = ProductServiceFallBack.class)
public interface ProductService {

    @GetMapping(value = "/product/{pid}")
    Product findByPid(@PathVariable("pid") Integer pid);

    /**
     * 减库存
     */
    @GetMapping("/seata/reduce")
   void reduceProduct(@RequestParam("pid") Integer pid, @RequestParam("num") int num);

}
